
import React, { PropTypes } from 'react';
import { observer } from 'mobx-react';
import store from '../../store';
import { setYear, setDay, setMonth } from '../../store/asyncDemo'

import Year from '../../components/Year';
import Month from '../../components/Month';
import Day from '../../components/Day';

@observer
class AsnycDemo extends React.Component {
    constructor(props) {
        super(props);
    }

    render() {
        const asyncStore = store.asyncStore;
        console.log(asyncStore);

        return (<div>
            <div>
                {asyncStore.year}年{asyncStore.month || '-'}月{asyncStore.day || '-'}日
            </div>
            <div>
                <Year begin={asyncStore.begin} end={asyncStore.end} year={asyncStore.year} onChange={setYear} />年
                <Month year={asyncStore.year} month={asyncStore.month} onChange={setMonth} />月
                <Day year={asyncStore.year} month={asyncStore.month} day={asyncStore.day} onChange={setDay} />日
            </div>
        </div>);
    }
}

export default AsnycDemo;
